import java.util.Scanner;
import java.util.Arrays;
import java.math.BigInteger;
//竞赛题目
public class Main {
    //幸运数字
    public static void main1(String[] args) {
        int count=0;
        long i=1l;
        while(count<2023) {
            if(func2(i)&&func10(i)&&func16(i)&&func8(i)) {
                count++;
            }
            i++;
        }
        System.out.println(i-1);

    }
    public static boolean func10(long a) {
        long n=a;
        int sum=0;
        while(a>0) {
            sum+=a%10;
            a/=10;
        }
        if(n%sum==0) return true;
        return false;
    }
    public static boolean func8(long a) {
        long n=a;
        int sum=0;
        while(a>0) {
            sum+=a%8;
            a/=8;
        }
        if(n%sum==0) return true;
        return false;
    }
    public static boolean func16(long a) {
        long n=a;
        int sum=0;
        while(a>0) {
            sum+=a%16;
            a/=16;
        }
        if(n%sum==0) return true;
        return false;
    }
    public static boolean func2(long a) {
        long n=a;
        int sum=0;
        while(a>0) {
            sum+=a%2;
            a/=2;
        }
        if(n%sum==0) return true;
        return false;
    }

//    数组分割
    public static void main2(String[] args) {
        Scanner scan=new Scanner(System.in);
        //表示有T组数据
        //思路当整个数组和为奇数的时候不可能达到
        int T=scan.nextInt();
        while(T>0) {
            //这组数据有N个数据
            int n=scan.nextInt();
            long[] arr=new long[n+1];
            for (int i = 1; i <= n; i++) {
                arr[i]=scan.nextLong();
            }
            //当数组和为奇数的时候不可能有两组偶数，偶数+偶数为奇数
            if(sum(arr)%2==1) {
                System.out.println(0);

            }
            //走到这里说明数组和为偶数，此时就可以转换为一组数据为偶数，另一组数据
            //一定也是偶数，那么可以转化为从n个数里面挑出来诺干个数和为偶数的问题，此时就变成了经典的动态规划问题，求dp[n][0]
            else {
                //定义dp[i][0]  从前i个数和为偶数的情况下挑出来的方案数
                //    dp[i][1] 从前i个数和为奇数的情况下挑出来的方案数
                long[][] dp=new long[n+1][2];
                //初始化dp
                dp[0][0]=1;
                dp[0][1]=0;
                for (int i = 1; i <= n; i++) {
                    if(arr[i]%2==0) {
                        //arr[i]为偶数
                        dp[i][0]=dp[i-1][0]+dp[i-1][0];
                        dp[i][1]=dp[i-1][1]+dp[i-1][1];
                        dp[i][0]%=1000000007;
                        dp[i][1]%=1000000007;
                    }else {
                        //奇数
                        dp[i][0]=dp[i-1][1]+dp[i-1][0];
                        dp[i][1]=dp[i-1][0]+dp[i-1][1];
                        dp[i][0]%=1000000007;
                        dp[i][1]%=1000000007;
                    }
                }
                System.out.println(dp[n][0]%1000000007l);
            }
            T--;

        }
    }
    public static long sum(long[] arr) {
        long sum=0L;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        return sum;

    }
//阶乘求和
    public static void main3(String[] args) {
        BigInteger i=BigInteger.ONE;
        BigInteger sum=BigInteger.ZERO;
        BigInteger mul=BigInteger.ONE;
        BigInteger max=new BigInteger("202320232023");
        BigInteger x=new BigInteger("1000000000");
        for (;i.compareTo(max)<=0;i=i.add(BigInteger.ONE)) {
            mul=mul.multiply(i);
            sum=sum.add(mul);
            sum=sum.divideAndRemainder(x)[1];
            System.out.println(sum);
        }
        System.out.println(420940313);
    }


//    蜗牛
    public static void main5(String[] args) {
        Scanner scan=new Scanner(System.in);
        //n代表横坐标的个数
        int n=scan.nextInt();
        long[] arr =new long[n+1];
        //arr[i]上的数值即为对应的横坐标
        for (int i = 1; i <=n; i++) {
            arr[i]=scan.nextLong();
        }
        long[][] chuan=new long[n+1][2];
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < 2; j++) {
                chuan[i][j]=scan.nextLong();
            }
        }
        //用动态规划来做 dp[i][1]到底第i根上传送门需要的最少时间，dp[i][0]到达
        //第i根底部需要最少的时间
        double[][] dp=new double[n+1][2];
        dp[0][0]=0;
        dp[1][0]=arr[1];
        dp[1][1]=arr[1];
        for (int i = 2; i <= n; i++) {
            double len=chuan[i-1][0]-chuan[i-2][1];
            if(len>0) {
                dp[i][0]=Math.min(Math.min(dp[i-1][0]+arr[i]-arr[i-1],dp[i-1][0]+chuan[i-1][0]/0.7+chuan[i-1][1]/1.3),
                        Math.min(dp[i-1][1]+len/0.7+chuan[i-1][1]/1.3, dp[i-1][1]+chuan[i-2][1]/1.3+arr[i]-arr[i-1]));
                dp[i][1]=Math.min(Math.min(dp[i-1][0]+chuan[i-1][0]/0.7, dp[i-1][0]+arr[i]-arr[i-1]+chuan[i-1][1]/0.7),
                        Math.min(dp[i-1][1]+len/0.7, dp[i-1][1]+chuan[i-2][1]/1.3+arr[i]-arr[i-1]+chuan[i-1][1]/0.7));
            }else {
                dp[i][0]=Math.min(Math.min(dp[i-1][0]+arr[i]-arr[i-1],dp[i-1][0]+chuan[i-1][0]/0.7+chuan[i-1][1]/1.3),
                        Math.min(dp[i-1][1]-len/1.3+chuan[i-1][1]/1.3, dp[i-1][1]+chuan[i-2][1]/1.3+arr[i]-arr[i-1]));
                dp[i][1]=Math.min(Math.min(dp[i-1][0]+chuan[i-1][0]/0.7, dp[i-1][0]+arr[i]-arr[i-1]+chuan[i-1][1]/0.7),
                        Math.min(dp[i-1][1]-len/1.3, dp[i-1][1]+chuan[i-2][1]/1.3+arr[i]-arr[i-1]+chuan[i-1][1]/0.7));
            }
        }
        System.out.printf("%.2f",dp[n][0]);

    }


    public static void main4(String[] args) {
        Scanner scan=new Scanner(System.in);
        //n代表横坐标的个数
        int n=scan.nextInt();
        long[] arr =new long[n+1];
        //arr[i]上的数值即为对应的横坐标
        for (int i = 1; i <=n; i++) {
            arr[i]=scan.nextLong();
        }
        long[][] chuan=new long[n][2];
        for (int i = 1; i < n; i++) {
            for (int j = 0; j < 2; j++) {
                chuan[i][j]=scan.nextLong();
            }
        }
        //用动态规划来做 dp[i][1]到底第i根上传送门需要的最少时间（起始传送点），dp[i][0]到达
        //第i根底部需要最少的时间
        double[][] dp=new double[n+1][2];
        dp[0][0]=0;
        dp[1][0]=arr[1];
        dp[1][1]=arr[1]+chuan[1][0]/0.7;
        for (int i = 2; i < n; i++) {
            double len=chuan[i][0]-chuan[i-1][1];
            if(len>0) {
                dp[i][0]=Math.min(dp[i-1][0]+arr[i]-arr[i-1], dp[i-1][1]+chuan[i-1][1]/1.3);
                dp[i][1]=Math.min(dp[i-1][0]+arr[i]-arr[i-1]+chuan[i][0]/0.7, dp[i-1][1]+len/0.7);
            }else {
                dp[i][0]=Math.min(dp[i-1][0]+arr[i]-arr[i-1], dp[i-1][1]+chuan[i-1][1]/1.3);
                dp[i][1]=Math.min(dp[i-1][0]+arr[i]-arr[i-1]+chuan[i][0]/0.7, dp[i-1][1]-len/1.3);
            }
        }
        if(n!=1)
            dp[n][0]=Math.min(dp[n-1][0]+arr[n]-arr[n-1], dp[n-1][1]+chuan[n-1][1]/1.3);
        System.out.printf("%.2f",dp[n][0]);

    }

//    矩形总面积
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        long x1=scan.nextLong();
        long y1=scan.nextLong();
        long x2=scan.nextLong();
        long y2=scan.nextLong();
        long x3=scan.nextLong();
        long y3=scan.nextLong();
        long x4=scan.nextLong();
        long y4=scan.nextLong();
        long rect1=0l;
        long rect2=0l;
        long dui=0l;
        //(x1,y1) (x2,y2)  ||    (x3,y3) (x4,y4)
        //情况一：两个矩形毫无交集
        rect1+=(y2-y1)*(x2-x1);
        rect2+=Math.abs(y4-y3)*Math.abs(x4-x3);
        if((x3>=x2&&y3>=y2)||(x4<=x1&&y4<=y1)) {
            System.out.println(rect1+rect2-dui);
        }else if(x3<=x1&&y3<=y1&&x4>=x2&&y4>=y2) {
            System.out.println(rect2);
        }else if(x3>=x1&&y3>=y1&&x4<=x2&&y4<=y2) {
            System.out.println(rect1);
        }else {
            long[] arr1=new long[4];
            arr1[0]=x1;
            arr1[1]=x2;
            arr1[2]=x3;
            arr1[3]=x4;
            long[] arr2=new long[4];
            arr2[0]=y1;
            arr2[1]=y2;
            arr2[2]=y3;
            arr2[3]=y4;
            Arrays.sort(arr1);
            Arrays.sort(arr2);
            dui+=(arr1[2]-arr1[1])*(arr2[2]-arr2[1]);
            System.out.println(rect1+rect2-dui);



        }

    }
}
